package com.lanou.utp.controller;

import com.lanou.utp.entity.LoginUser;
import com.lanou.utp.utils.TokenManager;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class LoginUserController {

    @Resource
    private TokenManager tokenManager;

    @RequestMapping("/getCurrentUser")
    @ResponseBody
    public LoginUser getCurrentUser(String token) {
        return tokenManager.parseLoginToken(token);
    }


}
